clc
clear all
close all

N  = 128;
x0 = [-10,0];
kx0 = [15,0];
dkx = [0.125,0.125];
L = 10;


S = createPsiK2D(kx0,dkx,x0,L,N);

N2 = N/2;



[Fm W W2] = creatingFilterMatrix(N,16);
%fourier wavelet filter
W = sparse(W)
Fnh = createFn(N2);
blkdiag(Fnh);
fnd = sparse(blkdiag(Fnh,Fnh));
A = diag(W2(1:N2,1));
C = diag(W2((N2+1):end,1));
B = diag(W2(1:N2,end));
D = diag(W2((N2+1):end,end));

Fw = sparse([A B;C D]);
clear A B C D Fm Fnh W2

%fourier
tic
ac = (W * S.').';
ws = W * ac;
fc = ((Fw * fnd) * ws.').';
fs = (Fw * fnd) * fc;
toc

